const Generator = require('yeoman-generator')
module.exports = class extends Generator {
    prompting() {
        return this.prompt([
            {
                type: "input",
                name: 'appName',
                message: "Your Project name",
                default: "my-project"
            }, {
                type: "input",
                name: 'description',
                message: 'Your Project description',
                default: 'A new Project'
            }
        ]).then(answer => this.answer = answer)
    }
    writing() {
        const templates = [
            '.editorconfig',
            '.gitignore',
            'package.json', '.postcssrc.js', 'README.md',
            'index.html',
            'src/App.vue', 'src/main.js', 'src/router/index.js',
            'src/assets/logo.png', 'src/components/HelloWorld.vue'
        ]
        templates.forEach(item => {
            this.fs.copyTpl(
                this.templatePath(item),
                this.destinationPath(item),
                this.answer
            )
        })
    }
}